package com.ap.generator.rtp;

import com.ap.core.cxf.jaxb.common.CurrencyCodeType;
import com.ap.core.cxf.jaxb.rtp.AbstractRTPSummaryTypeGeneratorBuilder;
import com.ap.core.cxf.jaxb.rtp.TransactionCheckOutType;
import com.ap.core.cxf.jaxb.rtp.TransactionType;
import com.ap.datagen.core.GeneratorHelper;

import static com.ap.datagen.core.GeneratorHelper.buildA;
import static com.ap.datagen.core.Nullable.nullable;
import static com.ap.datagen.date.JodaLocalDateTimeGeneratorBuilder.jodaLocalDateTimeGeneratorBuilder;
import static com.ap.generator.rtp.PaymtAmtInfoTypeGeneratorBuilder.getPaymentAmtInfoTypeGenerator;

/**
 * 
 * @author Siva.Pochana
 *
 */
public class RTPSummaryTypeGeneratorBuilder extends
		AbstractRTPSummaryTypeGeneratorBuilder {

	/**
	 * setupDefaults()
	 */
	@Override
	public void setupDefaults() {
		this.invoiceDateTimeGenerator = nullable(jodaLocalDateTimeGeneratorBuilder().build());
		this.currencyGenerator = nullable(GeneratorHelper.randomGeneratorFromEnum(CurrencyCodeType.GBP));
		this.paymtAmtInfoGenerator =nullable(buildA(getPaymentAmtInfoTypeGenerator()));
		this.txCheckoutGenerator = nullable(GeneratorHelper.fixedValueGenerator(TransactionCheckOutType.NRMLCHK));
		this.txIdentificationGenerator = nullable(buildA(TxIdentificationTypeGeneratorBuilder.getTxIdentificationTypeGenerator()));
		this.txRestrictionGenerator = nullable(GeneratorHelper.fixedValueGenerator("16PLUS"));
		this.txTypeGenerator = nullable(GeneratorHelper.fixedValueGenerator(TransactionType.PAYMT));
	}

	/**
	 * 
	 * @return
	 */
	public static RTPSummaryTypeGeneratorBuilder getRTPSummaryTypeGenerator() {
		return new RTPSummaryTypeGeneratorBuilder();
	}
	
	/**
	 * 
	 * @param value
	 * @return RTPSummaryTypeGeneratorBuilder
	 */
	public RTPSummaryTypeGeneratorBuilder withTxType(TransactionType value) {
		this.txTypeGenerator = nullable(GeneratorHelper.fixedValueGenerator(value));
		return this;
	}
	
	/**
	 * 
	 * @param txCheckoutEnum
	 * @return
	 */
	 public RTPSummaryTypeGeneratorBuilder getRTPSummaryType(final TransactionCheckOutType txCheckoutEnum){
		 	this.txCheckoutGenerator = nullable(GeneratorHelper.fixedValueGenerator(txCheckoutEnum));
		 	return this;
	}
	
}
